package com.aizhixin.test.errolAlmost.controller;

import java.util.List;

import javax.persistence.Tuple;
import javax.websocket.server.PathParam;

import org.aspectj.apache.bcel.classfile.Module.Require;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.aizhixin.test.errolAlmost.dto.SteamDTO;
import com.aizhixin.test.errolAlmost.service.steamAllService;
import com.aizhixin.test.errolAlmost.service.timeDifferenService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping(value="/v1/open/findErrolAll")
@Api(tags="已答过的题的查看（错对全）API")
@Slf4j
public class ErrolAllController {
	@Autowired
	private steamAllService errolAllService;
	/**
	 * 输入userId之后调用得到错题集合
	 */
	@GetMapping(value="/question1/{userId}",produces=MediaType.APPLICATION_JSON_VALUE)
	@ApiOperation(httpMethod="GET",value="查看错题集",notes="查看错题集<br><br><br>@author xixi</b>")
	public List<SteamDTO> getErrolList(
			@ApiParam(value="用户ID",required=true)
			@PathVariable Long userId){
				return errolAllService.getErrolAll(userId);
		
	}
	@GetMapping(value="/question2/{userId}",produces=MediaType.APPLICATION_JSON_VALUE)
	@ApiOperation(httpMethod="GET",value="查看对题集",notes="查看对题集<br><br><br>@author xixi</b>")
	public List<SteamDTO> getrightlList(
			@ApiParam(value="用户ID",required=true)
			@PathVariable Long userId){
				return errolAllService.getRightAll(userId);
		
	}
	@GetMapping(value="/question3/{userId}",produces=MediaType.APPLICATION_JSON_VALUE)
	@ApiOperation(httpMethod="GET",value="查看该用户所有题集",notes="查看对题集<br><br><br>@author xixi</b>")
	public List<SteamDTO> getALLlList(
			@ApiParam(value="用户ID",required=true)
			@PathVariable Long userId){
				return errolAllService.getsteamAll(userId);
		
	}
	@GetMapping(value="/submit",produces=MediaType.APPLICATION_JSON_VALUE)
	@ApiOperation(httpMethod="GET",value="输入关键字进行关于题目的模糊搜索",notes="输入关键字进行关于题目的模糊搜索<br><br><br>@author xixi</b>")
	public List<SteamDTO> getAboutImformation(
			@ApiParam(value="用户Id")
			@RequestParam(required=true,value="userId") Long userId,
			
			@ApiParam(value="关键字")
			@RequestParam(required=true,value="imformation") String importImfomation)
		{
		return errolAllService.getSteamByImformation(userId,importImfomation);
	}
}
